﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ExpertSMS.Models
{
    public class BillOfLading
    {
        public int BillOfLadingID { get; set; }
        public int SupplierID { get; set; }
        public int StoreID { get; set; }
        public DateTime Date { get; set; }
        public bool IsConfirmed { get; set; }

        public virtual Supplier Supplier { get; set; }
        public virtual Store Store { get; set; }
        public virtual ICollection<BillOfLadingProduct> BillOfLadingProducts { get; set; }
        public virtual decimal NetCost 
        { 
            get 
            {
                if (this.BillOfLadingProducts != null)
                    return BillOfLadingProducts.Sum(x => x.Cost);
                else
                    return 0.00M;
            } 
        }
    }
}